Page 102 - 2629_Devagiri_C-6
P. 102

21 st
                       INTERDISCIPLINARY LEARNING                                              Century   #Critical Thinking
                                                                                                Skills

                   Write a Python program to calculate the area of a square.


















                                                                                       MATHEMATICS





                         PRECEDENCE OF OPERATORS


                  Operator precedence determines  the order in which operations  are performed.  Operators
                  with higher precedence are evaluated first. When operators have the same precedence, Python
                  evaluates them from left to right (associativity). The following table shows the operator precedence,
                  starting with the highest precedence at the top:

                                     Operator                                       Name
                       ()                                     Parentheses
                       **                                     Exponentiation

                       *, /, //, %                            Multiplication, Division, Floor Division, Modulus
                       +, –                                   Addition, Subtraction
                        <, <=, >, >=, !=, ==                  Relational operators

                       not
                       and                                    Logical operators
                       or

                       =, %=, /=, //=, -=, +=, *=, **=        Assignment operators



                   RAPID RECALL                             Tick ( ) if you know this.


                      1.  A single-line comment begins with the hash symbol (#).

                      2.  Keywords are reserved, so you cannot use them as variable names or identifiers.









                  100
                        Premium Edition-VI



     5
   97   98   99   100   101   102   103   104   105   106   107